/*
 * @Description: 农资类型管理
 */
import zhreq from "@/api/axios";
export default {
  // getAllBasicList(params) {
  //   return zhreq.post("/v3/template/materialType/queryPageByCondition", {
  //     ...params,
  //     auditFlag: 1
  //   })
  // },
  // getFarmingAssetList(params) {
  //   return zhreq.post("/v3/templateTenant/materialType/queryPageByCondition", {
  //     ...params,
  //     auditFlag: 1,
  //     entity: {
  //       "organizationNo": sessionStorage.organizationNo
  //     }
  //   });
  // },
  getAllBasicList(params) {
    return zhreq.post("v3/template/materialType/queryTreeByCondition",{
      ...params
    })
  },
  getFarmingAssetList(params) {
    return zhreq.post("/v3/templateTenant/materialType/queryTreeByCondition", params);
  },
  /**
   * @description: 获取所有农资类型树状列表 *代表必填/agriculturalMaterialType/queryTreeList
   */
  getFarmingAssetTree() {
    return zhreq.get(`/agriculturalMaterialType/queryTreeList/${sessionStorage.farmingTypeNo}`);
  },

  queryByCondition(params) {
    return zhreq.post("/v3/templateTenant/materialType/queryByCondition", { ...params });
  },
  /**
   * @description: 查询所有农资类型列表
   */
  getallmeslist() {
    return zhreq.get(`/agriculturalMaterialType/queryList`);
  },
  /**
   * @description: 批量添加农资类型
   * @param {Object}  *
   */
  addList(params) {
    return zhreq.post('/v3/templateTenant/materialType/importPublicList', {
      list: params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 批量删除农资类型
   * @param {Object}  *
   */
  delList(params) {
    return zhreq.post('/v3/templateTenant/materialType/delListByNo', {
      list: params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  addListES(params) {
    return zhreq.post('/v3/template/applyMaterialType/add', {
      ...params,
      organizationNo: sessionStorage.organizationNo,
      isPlantSystemFlag: true
    });
  },
  editListES(params) {
    return zhreq.post('/v3/template/applyMaterialType/edit', {
      ...params
    });
  },
  getListES(params) {
    return zhreq.post('/v3/template/applyMaterialType/queryByCondition', {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  }
};
